/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ec.socialfun.controladores;

import java.io.IOException;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.jboss.logging.Logger;

/**
 *
 * @author jorge
 */
@ManagedBean
@RequestScoped
public class LogOutControlador {
    private static final Logger LOG = Logger.getLogger(LogOutControlador.class.getName());

    /**
     * Creates a new instance of LogOutControlador
     */
    public LogOutControlador() {
    }

    public void logoutCliente() {
        try {
            ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
            ec.invalidateSession();
            ec.redirect("../index.jsp");
        } catch (IOException ex) {
           LOG.error(" Error al desloguear " + ex);
        }
    }
    
    public void logout() {
        try {
            ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
            ec.invalidateSession();
            ec.redirect("../../index.jsp");
        } catch (IOException ex) {
           LOG.error(" Error al desloguear " + ex);
        }
    }
    
    public void logoutSucursal() {
        try {
            ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
            ec.invalidateSession();
            ec.redirect("../../../index.jsp");
        } catch (IOException ex) {
           LOG.error(" Error al desloguear " + ex);
        }
    }
}
